﻿using System.Diagnostics;

public class Shell
{
    public static string Run(string path, string parameters, string workingDirectory = "")
    {
        Process process = new Process();
        process.StartInfo.FileName = path;
        process.StartInfo.Arguments = parameters;
        process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
        process.StartInfo.CreateNoWindow = true;
        process.StartInfo.UseShellExecute = false;
        process.StartInfo.RedirectStandardOutput = true;
        process.StartInfo.RedirectStandardError = true;
        if (!string.IsNullOrEmpty(workingDirectory))
            process.StartInfo.WorkingDirectory = workingDirectory;
        process.Start();

        return process.StandardOutput.ReadToEnd();
    }
}